//
// Created by 17775 on 2024/10/17.
//

#ifndef RAYCI_POWERPROFILEBASE_H
#define RAYCI_POWERPROFILEBASE_H

#include <QWidget>
#include <QDockWidget>
#include "../qcustomplot.h"


QT_BEGIN_NAMESPACE
namespace Ui { class PowerProfileBase; }
QT_END_NAMESPACE

class PowerProfileBase : public QDockWidget {
Q_OBJECT

signals:
    void showPowerProfileSettings();

public:
    explicit PowerProfileBase(QWidget *parent = nullptr);
    ~PowerProfileBase() override;
    virtual void setTitleName(const QString& wTitle);
    void setYLabel(const QString& yTitle);
    void setCursorPos(double pos);
    void refreshCursorRange();
    void setCursorPosition(double pos);
    void changeXUnit(const QString& unit);
    void showAbscissa(bool show);
    void showOrdinate(bool show);
    void refreshViewRange();
    void refreshView();
    QList<double> convertVectorToQList(const std::vector<float>& vec);
    QCustomPlot *getCustomPlot() {
        return customPlot;
    }
    QCPItemLine *getVerticalLine() {
        return verticalLine;
    }
    void setTitle(double d, double pc);

private:
    Ui::PowerProfileBase *ui;
    QCustomPlot *customPlot = nullptr;
    QCPTextElement *title = nullptr;
    QMenu *m_contextMenu = nullptr;
    QCPItemLine *verticalLine = nullptr;
    double cursorPos = 0;
    double preCursorPos = 0;
};


#endif //RAYCI_POWERPROFILEBASE_H
